<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/estilo.css" type="text/css">
<SCRIPT language="javascript">
			
function validate(evt) {
	  var theEvent = evt || window.event;
	  var key = theEvent.keyCode || theEvent.which;
	  key = String.fromCharCode( key );
	  var regex = /[0-9]|\./;
	  if( !regex.test(key) ) {
	    theEvent.returnValue = false;
	    if(theEvent.preventDefault) theEvent.preventDefault();
	  }
	}
			
          function addRow(tableID) {

               var table = document.getElementById(tableID);

               

               var rowCount = table.rows.length;
				
               var row = table.insertRow(rowCount);
				
               document.getElementsByName("cantidadRows").item(0).value=rowCount;

               var cell1 = row.insertCell(0);
				
               var element1 = document.createElement("input");
               element1.name="check";
               element1.type = "checkbox";

               cell1.appendChild(element1);

 

               var cell2 = row.insertCell(1);
               
               var element2 = document.createElement("input");
               element2.name="nombreEmpresa";
               element2.type = "text";

               cell2.appendChild(element2);
              
               
               
               var cell3 = row.insertCell(2);

               var element3 = document.createElement("input");
               
               element3.type = "text";
               element3.name="tipoTarjeta";
               cell3.appendChild(element3);
               
               
               var cell4 = row.insertCell(3);
		
               var element4 = document.createElement("input");
               element4.name="valor";
               element4.type = "text";
				element4.onkeypress=onkeypress="validate(event)";
				element4.value="0";
				element4.maxlength="20";
               cell4.appendChild(element4);
               
               

          }

 

          function deleteRow(tableID) {

               try {

               var table = document.getElementById(tableID);

               var rowCount = table.rows.length;

 

               for(var i=0; i<rowCount; i++) {

                    var row = table.rows[i];

                    var chkbox = row.cells[0].childNodes[0];

                    if(null != chkbox && true == chkbox.checked) {

                         table.deleteRow(i);

                         rowCount--;

                         i--;

                    }
                    
                    document.getElementsByName("cantidadRows").item(0).value=rowCount-1;

               }

               }catch(e) {

                    alert(e);

               }

          }

 

     </SCRIPT>

</head>
<Title>Cerrar Caja Diaria</Title>
<h1>Cerrar Caja Diaria</h1>

<body>

<form action="CerrarCajaDiaria" method=post onsubmit="return confirm('Desea cerrar la caja?');">
Ingrese la cantidad de billetes y monedas en la caja:

<p>Billete $100: <input type="text" name="cienPesos" value="0" onkeypress="validate(event)" value="0" maxlength="3"/></p>
<p>Billete $50: <input type="text" name="cincuentaPesos" value="0"onkeypress="validate(event)" value="0" maxlength="3"/></p>
<p>Billete $20: <input type="text" name="veintePesos" value="0" onkeypress="validate(event)" value="0" maxlength="3"/></p>
<p>Billete $10: <input type="text" name="diezPesos" value="0" onkeypress="validate(event)" value="0" maxlength="3"/></p>
<p>Billete $5: <input type="text" name="cincoPesos" value="0" onkeypress="validate(event)" value="0" maxlength="3"/></p>
<p>Billete $2: <input type="text" name="dosPesos" value="0" onkeypress="validate(event)" value="0" maxlength="3"/></p>
<p>Moneda $1: <input type="text" name="unPeso" value="0" onkeypress="validate(event)" value="0" maxlength="3"/></p>
<p>Moneda $0.50: <input type="text" name="cincuentaCentavos" value="0" onkeypress="validate(event)" value="0" maxlength="3"/></p>
<p>Moneda $0.25: <input type="text" name="veinticincoCentavos" value="0" onkeypress="validate(event)" value="0" maxlength="3"/></p>
<p>Moneda $0.10: <input type="text" name="diezCentavos" value="0" onkeypress="validate(event)" value="0" maxlength="3"/></p>
<p>Moneda $0.05: <input type="text" name="cincoCentavos" value="0" onkeypress="validate(event)" value="0" maxlength="3"/></p>
<p>Moneda $0.01: <input type="text" name="unCentavo" value="0" onkeypress="validate(event)" value="0" maxlength="3"/></p>



<INPUT type="button" value="Add Row" onclick="addRow('dataTable');" />

<INPUT type="button" value="Delete Row" onclick="deleteRow('dataTable');" />

<INPUT type="number" name="cantidadRows" value="1"/>

     <TABLE id="dataTable"   border="1">
		<tr>
			<th></th>
			<th>Empresa</th>
			<th>Tipo Tarjeta</th>
			<th>Monto</th>
		</tr>
          <TR>
               <TD><INPUT type="checkbox" NAME="chk"/></TD>
               <TD> <INPUT type="text" name="nombreEmpresa" /> </TD>
               <TD> <INPUT type="text" name="tipoTarjeta"/> </TD>
               <TD> <INPUT type="text" name="valor" onkeypress="validate(event)" value="0" maxlength="20"/> </TD>
          </TR>

     </TABLE>

<p><input type="submit" name="submit" value="Cerrar Caja"/>

</form>


</body>

</html>